<template>
  <div class="show_box">
    <div class="show_msg">
      <template v-if="!isDel">
        <p>商品名: <input type="text" v-model="from.name"></p>
        <p>商品价格: <input type="text" v-model="from.price"></p>
      </template>
      <p v-else>确定删除吗</p>
      <div>
        <button @click="$emit('cancelBtn')">取消</button>
        <button @click="$emit('okBtn',from)">确定</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props:{
    isDel:{
      default:false
    }
  },
  data () {
    return {
      from:{
        name:'',
        price:''
      }
    }
  }
}
</script>

<style scoped>
.show_box{
  background-color: rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.show_msg{
  width: 300px;
  height: 100px;
  background-color: white;
  border-radius: 10px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
</style>